package com.hpq.user.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 *上下线状态
 */
@Getter
@AllArgsConstructor
public enum ChatActiveStatusEnum {
    ONLINE(1,"在线"),
    OFFLINE(2,"离线");
    private final Integer status;
    private final String desc;
    private static Map<Integer,ChatActiveStatusEnum> cache;
    static{
        cache= Arrays.stream(ChatActiveStatusEnum.values()).collect(Collectors.toMap(ChatActiveStatusEnum::getStatus, Function.identity()));
    }
    public static ChatActiveStatusEnum of(Integer status){
        return cache.get(status);
    }
}
